/**
*	流程模块
*	开发者：雨中磐石
*	地址：www.rockoa.com
*	日期：2023-07-29
*/


js.task_list = function(){
	
	
	this.initbodys = function(){
		//this.optobj.addbtn('停止计划任务','taskstop', this,'bg-danger');
		//this.optobj.addbtn('启动计划任务','taskstart', this,'bg-success');
		this.optobj.addbtn('清空运行','clearrun', this);
	}
	
	this.clearrun = function(){
		var me = this;
		js.ajax.get({
			loading:'清空中...',
			url:this.getacturl('clearrun'),
			loadsuccess:'清空成功'
		},function(ret){
			me.table.reload();
		});
	}
	
	this.taskstart = function(){
		var me = this;
		js.ajax.get({
			loading:'启动中...',
			url:this.getacturl('taskstart'),
			loadsuccess:'启动成功'
		},function(ret){
			me.table.reload();
		});
	}
	
	this.taskstop = function(){
		var me = this;
		js.ajax.get({
			loading:'停止中...',
			url:this.getacturl('taskstop'),
			loadsuccess:'停止成功'
		},function(ret){
			me.table.reload();
		});
	}
	
	this.onloadbefore=function(d){
		var s1 = '<font color=red>(未运行)</font>';
		if(d.tasklast){
			var jg = (js.now('time') - js.now('time', d.tasklast)) * 0.001;
			if(jg<=70)s1 = '<font color=green>(运行中)</font>';
		}
		var s = '上次运行'+d.tasklast+''+s1+'';
		if(get('lastyundiv')){
			$('#lastyundiv').html(s);
		}else{
			this.optobj.addright('<div id="lastyundiv">'+s+'</div>');
		}
	}
}
